import request from "@/utils/request";
import { PATH_SYS_DNF} from "@/utils/constant";
import {RecordVo} from "@/api/sys/dnf/record/types";

const baseUrl = PATH_SYS_DNF + '/record/'

/**
 * 查询记录列表 - 带分页
 * @param data
 */
export function getRecordVoListApi(data: PageQuery<RecordVo>): PromisePageListType<RecordVo> {
    return request.post(baseUrl + 'list', data)
}

/**
 * 通过记录id获取记录信息
 * @param id
 */
export function getRecordVoByIdApi(id: number): Promise<RecordVo> {
    return request.get(baseUrl + id)
}

/**
 * 获得该武器下一个等级,通过weaponType和level
 * @param weaponType
 * @param level
 */
export function getRecordVoNext(weaponType:number,level:number): Promise<RecordVo> {
    return request.post(baseUrl + 'next',{weaponType,level})
}

/**
 * 修改记录
 * @param id
 * @param data
 */
export function editRecordVoApi(id:number,data: RecordVo): Promise<any> {
    return request.patch(baseUrl+id, data)

}

/**
 * 添加记录
 * @param data
 */
export function addRecordVoApi(data: RecordVo): Promise<any> {
    return request.post(baseUrl, data)
}

/**
 * 删除记录
 * @param id
 */
export function deleteRecordVoApi(id: number): Promise<any> {
    return request.delete(baseUrl + id)
}